<%@page import="com.etc.zzsys.entity.Users"%>
<%@page import="java.util.List"%>
<%@page import="com.zzsys.dao.impl.UsersDaoImpl"%>
<%@page import="com.zzsys.dao.UsersDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!-- page指令 -->
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">

<title>用户登录</title>

<!-- Bootstrap core CSS -->
<link href="css/bootstrap.css" rel="stylesheet">

<!-- 登录有关的样式 -->
<link href="css/signin.css" rel="stylesheet">
<!-- jquery.js -->
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>

<body>


	<div class="container">
		<!-- 如何从表单页面跳转到servlet？ -->
		<form class="form-signin" action="us2" method="post">
			<h2 class="form-signin-heading">登录</h2>
			${sessionScope.msg}
			<label for="inputEmail" class="sr-only">用户名</label>
			<!-- 记得要加name的属性，在servlet一侧可以使用request的方法来获取用户输入的值，获取方法参数就是文本框的名字 -->
			<input type="text" id="username" name="username" class="form-control"
				placeholder="请输入用户名" required autofocus> <label
				for="inputPassword" class="sr-only">密码</label>
			<!-- 记得要加name的属性，在servlet一侧可以使用request的方法来获取用户输入密码的值，获取方法参数就是文本框的名字 -->
			<input type="password" id="userpwd" name="userpwd"
				class="form-control" placeholder="请输入密码" required>
			<!-- 记得要加name的属性，在servlet一侧可以使用request的方法来获取op的value -->
			<input type="hidden" name="op" value="login">
			<div class="checkbox">
				<label> <input type="checkbox" id="ck-remember"  name="ck-remember"
					value="remember-me"> 记住我
				</label>
			</div>
			<button class="btn btn-lg btn-primary btn-block" type="submit">登录</button>
		</form>
	</div>
	<!-- /container -->
	
	<!-- jstl遍历cookie的代码 -->

	<c:forEach items="${pageContext.request.cookies}" var="c">

		<c:if test="${c.name!=null && c.name eq 'remember-me'}">
			<%--   ${c.value}将c的value放在 username中去显示 --%>
			<script>
			$(function(){				
				$("#username").val('${c.value}');	
				$("#ck-remember").prop("checked","checked");
			});
			
			</script>
		</c:if>
	</c:forEach>


</body>
</html>
